<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
  <script src="./vue-router.js"></script>
</head>

<body>

  <div id="app">
    <router-link tag="button" to="/home">首页</router-link>
    <router-link tag="button" to="/position">职位</router-link>
    <router-link tag="button" to="/search">搜索</router-link>
    <router-link tag="button" to="/profile">我的</router-link>

    <header>
      <router-view name="a"></router-view>
    </header>
    <hr>
    <main>
      <router-view></router-view>
    </main>
    <hr>
    <footer>
      <router-view name="b"></router-view>
    </footer>



  </div>


  <script>

    var head = { template: '<div>头部的内容</div>' }
    var main = { template: '<div>主题的内容</div>' }
    var foot = { template: '<div>尾部的内容</div>' }


    var position = { template: `<div>position</div>` }
    var search = { template: `<div>search</div>` }
    var profile = { template: `<div>profile</div>` }

    var routes = [
      {
        path: "/",
        redirect: '/position'
      },
      {
        path:'/home',
        components:{
          a:head,
          default:main,
          b:foot
        }
      },
      {
        path: '/position',
        component: position
      },
      {
        path: '/search',
        component: search
      },
      {
        path: '/profile',
        component: profile
      }
    ]

    var router = new VueRouter({
      routes
    })

    var vm = new Vue({
      router
    }).$mount('#app')

  </script>

</body>

</html>